FROM ibm-semeru-runtimes:open-${project.properties.java.version}-jre-focal as builder

WORKDIR application
COPY /maven/${project.build.finalName}.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract

FROM ibm-semeru-runtimes:open-${project.properties.java.version}-jre-focal

WORKDIR /opt/application/
USER 1000:1000
EXPOSE 8080

COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./

ENV TZ=Asia/Shanghai

ENTRYPOINT ["java", "-ea", "org.springframework.boot.loader.JarLauncher"]
